1#!/bin/bash
2
3OPENSCAD=openscad
4if [ "$(uname -s)" == "Darwin" ]; then
5 OPENSCAD=/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
6fi
7
8INFILES=("$@")
9if (( ${#INFILES[@]} == 0 )); then
10 INFILES=(tests/test_*.scad)
11fi
12
13OUTCODE=0
14for testfile in "${INFILES[@]}"; do
15 if [[ -f "$testfile" ]] ; then
16 repname="$(basename "$testfile" | sed 's/^test_//')"
17 "${OPENSCAD}" -o out.echo --hardwarnings --check-parameters true --check-parameter-ranges true "$testfile" 2>&1
18 retcode=$?
19 output=$(cat out.echo)
20 if (( retcode == 0 )) && [[ "$output" = "" ]]; then
21 echo "$repname: PASS"
22 else
23 echo "$repname: FAIL!"
24 echo "$output"
25 OUTCODE=1
26 fi
27 rm -f out.echo
28 fi
29done
30exit "$OUTCODE"
31